import { SUPPLIER_TYPE_SELECT_LIST } from '@/pages/supplier/constants/common'
import { getInitialFieldsValue } from '@/pages/supplier/utils'

// 供应商管理 - 特殊供应商
const FORM_ITEM_LIST = [
  { prop: 'supplierCode', label: '供应商代码', type: 'input', },
  { prop: 'supplierName', label: '供应商名称', type: 'input', },
  { prop: 'mainCategoryId', label: '主营品类', type: 'categorySelect', },
  { prop: 'supplierType',
    label: '供应商类型',
    type: 'select',
    clearable: true,
    options: SUPPLIER_TYPE_SELECT_LIST.filter((item) => {
      // 特殊供应商供应商类型：内部加工供应商、分公司、财务供应商、通用供应商
      return [1005, 1006, 1008, 1010].includes(item.value)
    })
  },
  { prop: 'managementAreaId', label: '供应商管理区域', type: 'managementArea' },
  { prop: 'paidType', label: '付款方式', type: 'select', clearable: true, sysDict: 10131 },
  { prop: 'checkoutRange', label: '结账区间', type: 'select', clearable: true, sysDict: 10133 },
  { prop: 'settlementType', label: '结算方式', type: 'select', clearable: true, sysDict: 10173 },
  { prop: 'centralizedSettle', label: '是否集中结账', type: 'select', clearable: true, dict: 18 },
  { prop: 'centralizedSettlePlace', label: '集中结账地', type: 'select', clearable: true, dict: 224 },
]
const INITIAL_FIELDS_VALUE = getInitialFieldsValue(FORM_ITEM_LIST)

const TABLE_COLUMNS = [
  { title: '供应商代码', key: 'supplierCode', },
  { title: '供应商名称', key: 'supplierName', },
  { title: '供应商分类', key: 'supplierClassifyName', },
  { title: '供应商类型', key: 'supplierTypeName', },
  { title: '主营品类代码', key: 'mainCategoryCode', },
  { title: '主营品类名称', key: 'mainCategory', },
  { title: '供应商管理区域', key: 'managementAreaName', },
  { title: '付款方式', key: 'paidTypeName', },
  { title: '结账时间', key: 'checkoutTimeName', },
  { title: '结账区间', key: 'checkoutRangeName', },
  { title: '结算方式', key: 'settlementTypeName', },
  { title: '是否集中结账', key: 'centralizedSettleName', },
  { title: '集中结账地', key: 'centralizedSettlePlaceName', },
]

export {
  INITIAL_FIELDS_VALUE,
  FORM_ITEM_LIST,
  TABLE_COLUMNS
}
